<template>
  <div class="containers">
    <div class="con-1">
      <div class="titles"><span class="si-1">*</span>问题类型:</div>
      <van-radio-group v-model="objs.consultType">
        <div class="radio-groups">
          <div class="radio-group1 mas-1">
            <div>
              <div class="c-a1">操作使用</div>
              <div class="c-a2">使用过程中的问题</div>
            </div>
            <van-radio name="1"></van-radio>
          </div>
          <div class="radio-group1">
            <div>
              <div class="c-a1">应用异常</div>
              <div class="c-a2">功能,数据异常</div>
            </div>
            <van-radio name="2"></van-radio>
          </div>
        </div>
      </van-radio-group>

      <div class="titles kijs"><span class="si-1">*</span>问题描述:</div>
      <van-cell-group inset>
        <van-field
          border
          v-model="objs.consultTitle"
          rows="6"
          autosize
          type="textarea"
        />
      </van-cell-group>
    </div>
  </div>
  <div class="btn-s">
    <van-button type="primary" class="btn-1" size="normal" @click="add"
      >提交</van-button
    >
  </div>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { showToast } from 'vant'
import { askQuestion } from '@/services/user'

const objs: any = ref({
  consultTitle: '',
  consultType: null
})
const add = async () => {
  if (!objs.value.consultType) {
    showToast('请选择问题类型')
    return
  }
  if (!objs.value.consultTitle) {
    showToast('请输入问题描述')
    return
  }
  const res = await askQuestion(objs.value)
  if (res.code === 200) {
    showToast('提交成功')
    objs.value = {}
  }
}

onMounted(() => {})
</script>

<style lang="scss" scoped>
.containers {
  width: 100%;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
}
.con-1 {
  width: 100%;
  height: 500px;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  box-sizing: border-box;
}
.btn-s {
  position: fixed;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  bottom: 0;
  background: #fff;
  right: 0;
  z-index: 99;
  padding: 0 10px;
  box-sizing: border-box;
}
.btn-1 {
  width: 100%;
  height: 30px;
}
.titles {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 10px;
}
.radio-groups {
  display: flex;

  width: 100%;
  height: 60px;
  box-sizing: border-box;
}
.radio-group1 {
  flex: 1;
  height: 100%;
  background: #f1f1f1;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
}
.mas-1 {
  margin-right: 10px;
}
.c-a1 {
  font-size: 14px;
  font-weight: 600;
  color: #0e0c0c;
  margin-bottom: 5px;
}
.c-a2 {
  font-size: 12px;

  color: #dfdfe1;
}
.kijs {
  margin-top: 30px;
}
:deep() .van-field__control {
  border: 1px solid #a9a2a2;
}
.si-1 {
  color: red;
}
</style>
